var crypto = require('crypto'),
	decipher,
	_ = require('underscore');

module.exports.encryptByMD5 = function(value,key) {
	if (_.isUndefined(value)) {
		return "";
	}
	decipher = crypto.createHash('md5',key);
	if (key) {
		return decipher.update(value).digest()
	}
	return decipher.update(value).digest('base64')
}